
cmake_minimum_required(VERSION 3.18.1)

project("study")

# 可以使用message来打印信息
message("-------------------")
message(${CMAKE_BUILD_TYPE})
message(${ANDROID_PLATFORM})
message(${CMAKE_SOURCE_DIR})
message(${ANDROID_ABI})

# 添加rtmp库的子目录
add_subdirectory(librtmp)

# 将cpp文件归类，可以避免每个cpp文件都要声明
file(GLOB cpp_source *.cpp)

# 集成自己编译的x264库
# x264头文件引入
include_directories(${CMAKE_SOURCE_DIR}/x264/${ANDROID_ABI}/include)
# x264静态库
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -L${CMAKE_SOURCE_DIR}/x264/${ANDROID_ABI}/lib")

add_library(
        study
        SHARED
        # 引入所有.cpp结尾的文件。不用在声明每一个cpp的文件了
        ${cpp_source}
        # native-lib.cpp
        # X264Helper.cpp
)

find_library(
        log-lib
        log)

target_link_libraries(
        study
        # 添加rtmp库
        rtmp
        x264
        ${log-lib})